package com.kaluli.project.repository.impl;

import com.kaluli.project.domain.entity.KllProduct;
import com.kaluli.project.domain.entity.KllProductSku;
import com.kaluli.project.domain.repository.KllItemSkuRepository;
import com.kaluli.system.repository.AbstractRepositorySupport;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class KllItemSkuRepositoryImpl extends AbstractRepositorySupport<KllProductSku> implements KllItemSkuRepository{

	@Override
	protected Class<KllProductSku> getEntityClass() {
		// TODO Auto-generated method stub
		return KllProductSku.class;
	}

	
	
	public KllProductSku findItemSku(Long id){
		StringBuffer hql=new StringBuffer(" from KllProductSku k where k.id=:goodsId");
		Map<String,Object> params=new HashMap<String, Object>();
		params.put("goodsId", id);
		List<KllProductSku> list =  this.findHqlForMap(hql.toString(), params);
		KllProductSku kllProduct = null;
		if(list!=null&list.size()>0){
			kllProduct = list.get(0);
		}
		return kllProduct;
	}

	
	

}
